
package ch.hearc.coursJava.exa.swing;

import java.io.File;

import javax.swing.filechooser.FileFilter;

public class BinFilter extends FileFilter
	{
	//Accept all directories and all gif, jpg, tiff, or png files.
	@Override
	public boolean accept(File f)
		{
	    if (f.isDirectory())
	    	{
	        return true;
	    	}

	    String extension = Utils.getExtension(f);
	    if (extension != null)
	    	{
	        if (extension.equals(Utils.bin))
	        	{
	            return true;
	            }
	        else
	        	{
	            return false;
	        	}
	    	}

	    return false;
		}

	//The description of this filter
	@Override
	public String getDescription()
		{
	    return "Just binary files";
		}
	}

